# 配置 android 编译选项
if("${ANDROID_ABI}" STREQUAL "armeabi-v7a")
   set(ARCH "arm")
   set(CPU "armv7-a")
   set(TARGET_ABI "armv7a-linux-androideabi" CACHE STRING "目标 ABI")
   set(CMAKE_C_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${TARGET_ABI}${ANDROID_PLATFORM}-clang CACHE PATH "gcc 编译器")
   set(CMAKE_CXX_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${TARGET_ABI}${ANDROID_PLATFORM}-clang++ CACHE PATH "g++ 编译器")
elseif("${ANDROID_ABI}" STREQUAL "arm64-v8a")
   set(ARCH "aarch64")
   set(CPU "armv8-a")
   set(TARGET_ABI "aarch64-linux-android" CACHE STRING "目标 ABI")
   set(CMAKE_C_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${TARGET_ABI}${ANDROID_PLATFORM}-clang CACHE PATH "gcc 编译器")
   set(CMAKE_CXX_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${TARGET_ABI}${ANDROID_PLATFORM}-clang++ CACHE PATH "g++ 编译器")
elseif("${ANDROID_ABI}" STREQUAL "x86")
   set(ARCH "x86")
   set(CPU "i686" CACHE PATH "架构")
   set(TARGET_ABI "i686-linux-android" CACHE STRING "目标 ABI")
   set(CMAKE_C_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${TARGET_ABI}${ANDROID_PLATFORM}-clang CACHE PATH "gcc 编译器")
   set(CMAKE_CXX_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${TARGET_ABI}${ANDROID_PLATFORM}-clang++ CACHE PATH "g++ 编译器")
elseif("${ANDROID_ABI}" STREQUAL "x86_64")
   set(ARCH "x86_64")
   set(CPU "x86-64")
   set(MARCH ${CPU} CACHE PATH "架构")
   set(TARGET_ABI "x86_64-linux-android" CACHE STRING "目标 ABI")
   set(CMAKE_C_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${TARGET_ABI}${ANDROID_PLATFORM}-clang CACHE PATH "gcc 编译器")
   set(CMAKE_CXX_COMPILER ${ANDROID_TOOLCHAIN_ROOT}/bin/${TARGET_ABI}${ANDROID_PLATFORM}-clang++ CACHE PATH "g++ 编译器")
else()
   message(FATAL_ERROR "不支持的 ANDROID_ABI: ${ANDROID_ABI}")
endif()
# 配置 android 编译选项
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    set(CMAKE_C_FLAGS "-g3 -O0 -fno-omit-frame-pointer -fPIC -march=${CPU}" CACHE STRING "编译选项")
    set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections" CACHE STRING "链接选项")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
    set(CMAKE_C_FLAGS "-fPIC -fdata-sections -ffunction-sections " CACHE STRING "编译选项")
    set(CMAKE_EXE_LINKER_FLAGS "-s -Wl,--gc-sections" CACHE STRING "链接选项")
endif()
# 配置 android 工具链
set(CROSS ${ANDROID_TOOLCHAIN_ROOT}/bin/llvm- CACHE PATH "工具链前缀")
set(AR ${CROSS}ar CACHE PATH "工具链 ar 程序")
set(RANLIB ${CROSS}ranlib CACHE PATH "工具链 ranlib 程序")
set(STRIP ${CROSS}strip CACHE PATH "工具链 strip 程序")








